package com.flash.BusinessParameters.mapper;


import com.flash.BusinessParameters.entity.BondSetting;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface BondSettingMapper {


    /**
     * 按条件查询加分页
     * @param map 查询的参数
     * @return 用户的集合
     */
    @Select("select * from (select rownum rn,b.* from bond b) where 1=1 ${strWhere} and rn between #{page} and #{limit}")
    public List<BondSetting> selectBondSettingMap(Map map);

    /**
     * 按条件删除
     */
    @Delete("delete from bond where bondId=#{bondId}")
    public int deleteBondSetting(int bondId);

    //添加
    @Insert("insert into bond values(#{bondId},#{bondName},#{bearingStart},#{bearingEnd},#{bondType},#{faceAmount},#{bondInterest},#{delayDate},#{interestTime},#{bondRemark})")
    public int insertBondSetting(BondSetting bondSetting);

    //查询所有
    @Select("select * from bond")
    public List<BondSetting> selectBondSetting();

    //修改
    @Update("update bond set bondName=#{bondName},bearingStart=#{bearingStart},bearingEnd=#{bearingEnd},bondType=#{bondType},faceAmount=#{faceAmount}," +
            "bondInterest=#{bondInterest},delayDate=#{delayDate},interestTime=#{interestTime},bondRemark=#{bondRemark} where bondId=#{bondId}")
    public int updateBondSetting(BondSetting bondSetting);

    //查询多少条
    @Select("select count(*) from bond")
    public int selectCountBondSetting();
}
